#include "Model.h"


long Model::idCounter = 0;

Model::Model()
{
    id = idCounter++;
}

void Model::traverse(const Event& event)
{
    handleEvent(event);
}

void Model::handleEvent(const Event& event)
{
}

long Model::getId()
{
    return id;
}

void Model::collectChanges(NetworkEvents& events)
{
    events.insert(events.end(), eventsToSend.begin(), eventsToSend.end());
    eventsToSend.clear();
}

void Model::addChangeEvent(NetworkEvent* event)
{
    eventsToSend.push_back(std::pair<NetworkEventPtr, int>(NetworkEventPtr(event),-1));
}

void Model::addChangeEvent(NetworkEvent* event, int playerId)
{
    eventsToSend.push_back(std::pair<NetworkEventPtr,int>(NetworkEventPtr(event),playerId));
}

Model::~Model()
{
}

